<template>
<div>
   <el-breadcrumb separator-class="el-icon-arrow-right">
  <el-breadcrumb-item :to="{ path: '/StudentMain' }">首页</el-breadcrumb-item>
  <el-breadcrumb-item>学生管理</el-breadcrumb-item>
  <el-breadcrumb-item>选课信息</el-breadcrumb-item>
</el-breadcrumb>
  <el-button type="info" @click="back">返回</el-button>
 <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      prop="selectname"
      label="教师名"
      width="300">
    </el-table-column>
    <el-table-column
      prop="courseid"
      label="课程课程号"
      width=300>
    </el-table-column>
    <el-table-column
      prop="coursename"
      label="课程课程名"
      width="300">
    </el-table-column>
    <el-table-column
      prop="selectedtime"
      label="选课时间"
      width="200">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作">
        <el-button @click="backStudent()" type="primary" size="small" icon="el-icon-edit">返回学生页面</el-button>
    </el-table-column>
  </el-table>
 <el-pagination
   background
  layout="prev, pager, next"
   :page-size='pagesize'
  :total="total"
  @current-change="page">
</el-pagination>
</div>
</template>

<script>
import axios from 'axios'
export default {
  methods: {
    deleteid (row) {
      axios.delete(`http://localhost:8082/StudentManagement-Web/selectcourse/delete/${row.id}.json`).then(function (resp) { })
      alert('删除成功')
    },
    edid (row) {
      this.$router.push({
        path: '/SelectCourseUpdata',
        query: {
          id: row.id
        }
      })
    },
    page (currentPage) {
      const _this = this
      axios.get(`http://localhost:8082/StudentManagement-Web/selectcourse/findall/${currentPage}/20.json`).then(function (resp) { _this.tableData = resp.data.content; _this.total = resp.data.totalElements })
    },
    back () {
      this.$router.replace('/Home')
    },
    backStudent () {
      this.$router.replace('/StudentMain')
    }
  },
  created () {
    const _this = this
    axios.get('http://localhost:8082/StudentManagement-Web/selectcourse/findall/1/20.json').then(function (resp) { _this.tableData = resp.data.content; _this.total = resp.data.totalElements })
  },
  data () {
    return {
      total: null,
      tableData: null
    }
  }
}
</script>
